;;(load "def.scm")
(define (get-num s m n)
  (let ((len (string-length s))
        )
    (cond
      ((>= n len)
       (list (substring s m len) (- n m 1) '整数)) 
      ((rd-digit (string-ref s n))
       (get-num s m (+ n 1)))
      (else (list (substring s m n) (- n m 1) '整数)))))
(define (rd-小数点 c)(char=? c #\.))
(define (rd-正负号 c)(or (char=? c #\+)(char=? c #\-)))
(define (rd-指数符号 c)(or (char=? c #\e)(char=? c #\E)))
(define (rd-分数符号 c)(char=? c #\/))
(define (get-数值 s m n st)
  (let* ((len (string-length s))
         (c (if (< n len) (string-ref s n)))
         )
    (cond
      ((or (>= n len)(rd-all-deli c))
       (if (or (eq? st '整数)(eq? st '小数)(eq? st '分数)(eq? st '指数数))
           (list (substring s m len) (- n m 1) st)
	   (begin
	     ;;(err-msg "错误信息[get-数值][~a]：[~a]不是可用数值状态。" n st)
	     (list 'err (- n m 1) st '非法数值状态))))
      ((and (eq? st '开始)(rd-正负号 c))
       (set! st '正负号)
       (get-数值 s m (+ n 1) st))
      ((and (or (eq? st '整数)(eq? st '正负号)(eq? st '开始))(rd-digit c))
       (set! st '整数)
       (get-数值 s m (+ n 1) st))
      ((eq? st '整数)
       (cond
         ((rd-小数点 c)
          (set! st '小数点)
          (get-数值 s m (+ n 1) st))
         ((rd-分数符号 c)
          (set! st '分数符号)
          (get-数值 s m (+ n 1) st))
         ((rd-指数符号 c)
          (set! st '指数符号)
          (get-数值 s m (+ n 1) st))
	 (else (list (substring s m n) (- n m 1) st))))
      ((and (eq? st '小数)(rd-指数符号 c))
       (set! st '指数符号)
       (get-数值 s m (+ n 1) st))
      ((and (or (eq? st '小数点)(eq? st '小数))(rd-digit c))
       (set! st '小数)
       (get-数值 s m (+ n 1) st))
      ((and (or (eq? st '分数符号)(eq? st '分数))(rd-digit c))
       (set! st '分数)
       (get-数值 s m (+ n 1) st))
      ((and (eq? st '指数符号)(rd-正负号 c))
       (set! st '指数正负号)
       (get-数值 s m (+ n 1) st))
      ((and (or (eq? st '指数符号)(eq? st '指数正负号)(eq? st '指数数))(rd-digit c))
       (set! st '指数数)
       (get-数值 s m (+ n 1) st))
      (else (if (or (eq? st '整数)(eq? st '小数)(eq? st '分数)(eq? st '指数数))
		(list (substring s m n) (- n m 1) st)
		(begin
		  ;;(err-msg "错误信息[get-数值][~a]：[~a]前部分不是数值。" n st)
		  (list (substring s m n) (- n m 1) '非数值)))))))
(define (get-value s n)(get-数值 s n n '开始))
      
         
                  
       

       
